package inet.app.vod.util;

import inet.app.vod.activity.common.BaseActivity;
import android.app.AlertDialog;
import android.content.DialogInterface;

import com.inet.app.framework.util.Log;
import com.inet.app.framework.util.Util;

public class MyUtil extends Util {

	private static AlertDialog alertDialog;

	/**
	 * Show alert dialog
	 * 
	 * @param message
	 * @param activity
	 */
	public static void showDialog(String message, BaseActivity activity) {
		if (!activity.isRunning()) {
			Log.e("activity isn't running");
		} else {
			if (alertDialog != null && alertDialog.isShowing()) {
				alertDialog.dismiss();
			}
			AlertDialog.Builder builder = new AlertDialog.Builder(activity);
			builder.setTitle("Thông báo");
			builder.setMessage(message);
			builder.setPositiveButton("Đóng",
					new DialogInterface.OnClickListener() {
						public void onClick(DialogInterface dialog, int which) {
							dialog.dismiss();
						}
					});
			alertDialog = builder.create();
			alertDialog.show();
		}
	}

}
